Strict

' scoreoid test scaffold

Import mojo

Import scoreoidnet
Import debug_printer

Global API_KEY:String
Global GAME_ID:String

Class ScoreoidTest
	Field BaaS:BaaSEngine
	Field Player:BaaSPlayer ' this will hold all your player data
	
	Method New()
	
		' put your data in scoreoid.txt in this format:
		' api_key=YourGameAPIKey
		' game_id=Your Game Name/ID

		Local gameid:String = LoadString("scoreoid.txt")
		Local sApikey:String = ""
		Local sGameid:String = ""
		
		BaaS = New BaaSEngine
		Player = New BaaSPlayer

		' load the API_KEY and GAME_ID from scoreoid.txt
		If gameid Then
			Local lines:String[] = gameid.Split("~n")
			Local temp:String[] = lines[0].Split("=")
			If temp[0] = "api_key" Then
				sApikey = temp[1].Trim()
			EndIf
			temp = lines[1].Split("=")
			If temp[0] = "game_id" Then
				sGameid = temp[1].Trim()
			EndIf
			
			BaaS.setAPIKey(sApikey)
			BaaS.setGameID(sGameid)
		EndIf
		
#If TARGET="html5" Then
	BaaS.setURL("scoreoid_proxy.php")
	dp "Target is HTML5"
#Else
	dp "Target is not HTML5"
#EndIf

		If BaaS.Ping() Then
			dp "Scoreoid server is ready for '" + BaaS.getGameName() + "'"
		Else
			dp "Scoreoid server unavailable for '" + BaaS.getGameName() + "'"
		EndIf
		
	End
	
End

Function Main:Int()
	New ScoreoidTest
	Return 0
End